package services;

public class UserDataServicesProxy implements services.UserDataServices {
  private String _endpoint = null;
  private services.UserDataServices userDataServices = null;
  
  public UserDataServicesProxy() {
    _initUserDataServicesProxy();
  }
  
  public UserDataServicesProxy(String endpoint) {
    _endpoint = endpoint;
    _initUserDataServicesProxy();
  }
  
  private void _initUserDataServicesProxy() {
    try {
      userDataServices = (new services.UserDataServicesServiceLocator()).getUserDataServices();
      if (userDataServices != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)userDataServices)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)userDataServices)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (userDataServices != null)
      ((javax.xml.rpc.Stub)userDataServices)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public services.UserDataServices getUserDataServices() {
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices;
  }
  
  public java.lang.Object[] getData(services.User user) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.getData(user);
  }
  
  public int addData(services.UserData data) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.addData(data);
  }
  
  public boolean deleteData(int id) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.deleteData(id);
  }
  
  public boolean updateData(services.UserData data) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.updateData(data);
  }
  
  public java.lang.Object[] getAlarmTypes() throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.getAlarmTypes();
  }
  
  public java.lang.Object[] getDataInterval(services.User user, java.util.Calendar startDate, java.util.Calendar endDate) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.getDataInterval(user, startDate, endDate);
  }
  
  public void addAlarmType(services.AlarmType type) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    userDataServices.addAlarmType(type);
  }
  
  public int addAlarmClock(services.AlarmClock clock) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.addAlarmClock(clock);
  }
  
  public java.lang.Object[] getAlarmClocks(services.User user) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.getAlarmClocks(user);
  }
  
  public boolean deleteAlarmClock(int id) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.deleteAlarmClock(id);
  }
  
  public boolean updateAlarmClock(services.AlarmClock clock) throws java.rmi.RemoteException{
    if (userDataServices == null)
      _initUserDataServicesProxy();
    return userDataServices.updateAlarmClock(clock);
  }
  
  
}